<?php
class AdSlogan extends Portlet
{
	public $ad_id;
	private $_content;
	private $_uid;
	private $_profile;
	
	public function init()
	{
		$criteria = new CDbCriteria(array(
			'condition'=>'t.adid ='.$this->ad_id,
			'select'=>'count(t.id) as pubCount',
			'order'=>'pubCount DESC',
			'group'=>'t.sid'
		));
		$pub =  Published::model()->with('slogan','owner.info')->find($criteria);
		$this->_content = $pub->slogan->content;
		$this->_uid = $pub->owner->id;
		$this->_profile = $pub->owner->info->profile;
		$this->htmlOptions = array('class'=>'over-hidden');
		parent::init();
	}
	
	protected function renderContent()
	{
		echo CHtml::openTag('div',array('class'=>'avatar float-left'));
		echo CHtml::link(CHtml::image('https://adbyme-w.s3.amazonaws.com/thumbs/User/9768.30x30.crop.png','',array('style'=>'width:20px;height:20px')),Yii::app()->createUrl('works/slogans',array('uid'=>$this->_uid)));
		echo CHtml::closeTag('div');
		echo CHtml::Tag('div',array('class'=>'slogan float-left mg-l-5'),$this->_content);
	}
}